package com.dodo.baseproject.controller;

import com.alibaba.fastjson.JSONObject;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping(value = "test")
public class TestController {
    private static Logger logger = LoggerFactory.getLogger(TestController.class);

    /**
     * loginAction
     * @param username
     * @return
     */
    @PostMapping(value = "loginAction")
    public ResponseEntity<JSONObject> loginAction(@RequestParam String username){
        logger.info("username:{}",username);
        JSONObject jsonObject = new JSONObject();
        jsonObject.put("msg","login_success");
        return new ResponseEntity<>(jsonObject, HttpStatus.OK);
    }
}
